HAL RTC tamper functions migration

This section provides information about the HAL RTC tamper functions migration.

Important

The Tamper APIs are now in a separated Driver in HAL2 “TAMP”.

Note

  • The RTC handle is removed in HAL2, so for the following TAMPER HAL2 functions, the handle will be removed from the parameters.

    Related concept: Other HAL RTC changes

  • There are tamper functions that can handle severale tampers at the same time,

    there are other tamper functions that function only handle one single tamper at a time,

    user can identify rapidly which is function can handle severale tampers and which can only handle one single tamper by checking the function naming (functions that can handle severale tampers ends with s):

    • tamper: one single tamper at a time. example: HAL_TAMP_ACTIVE_GetConfigTamper()

    • tampers: multiple tampers. example: HAL_TAMP_INTERNAL_SetConfigTampers()

HAL RTC set tamper

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc,
                                      RTC_TamperTypeDef *sTamper)
hal_status_t HAL_TAMP_PASSIVE_SetConfig(const hal_tamp_passive_config_t *p_config)
hal_status_t HAL_TAMP_PASSIVE_SetConfigTampers(uint32_t tampers,
                                               const hal_tamp_passive_individual_config_t *p_config)
hal_status_t HAL_TAMP_PASSIVE_Start(uint32_t tampers, uint32_t interruption)

HAL RTC set active tampers

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetActiveTampers(RTC_HandleTypeDef *hrtc,
                                             RTC_ActiveTampersTypeDef *sAllTamper)
hal_status_t HAL_TAMP_ACTIVE_SetConfig(const hal_tamp_active_config_t *p_config)
hal_status_t HAL_TAMP_ACTIVE_SetConfigTampers(uint32_t tampers_input,
                                              const hal_tamp_active_individual_config_t *p_config)
hal_status_t HAL_TAMP_ACTIVE_Start(uint32_t tampers, uint32_t interruption, const uint32_t *p_seeds)

HAL RTC set active seed

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetActiveSeed(RTC_HandleTypeDef *hrtc,
                                          uint32_t *pSeed)
hal_status_t HAL_TAMP_ACTIVE_SetSeed(const uint32_t *p_seeds)

HAL RTC set tamper IT

In HAL2, there is no dedicated function for enabling passive tamper interrupts.

Instead, you need to follow the same sequence and enable the interrupt by passing it as an argument to the HAL_TAMP_PASSIVE_Start() function using HAL_TAMP_IT_TAMPER_1.

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc,
                                         RTC_TamperTypeDef *sTamper)
hal_status_t HAL_TAMP_PASSIVE_SetConfig(const hal_tamp_passive_config_t *p_config)
hal_status_t HAL_TAMP_PASSIVE_SetConfigTampers(uint32_t tampers,
                                               const hal_tamp_passive_individual_config_t *p_config)
hal_status_t HAL_TAMP_PASSIVE_Start(uint32_t tampers, uint32_t interruption)

HAL RTC deactivate tamper

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc,
                                             uint32_t Tamper)
hal_status_t HAL_TAMP_PASSIVE_Stop(uint32_t tampers)

HAL RTC deactivate active tampers

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateActiveTampers(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_TAMP_ACTIVE_Stop(uint32_t tampers)

HAL RTC poll for tamper event

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_PollForTamperEvent(RTC_HandleTypeDef *hrtc,
                                               uint32_t Tamper,
                                               uint32_t Timeout)
hal_status_t HAL_TAMP_PASSIVE_PollForEvent(uint32_t tampers,
                                           uint32_t timeout_ms)

HAL RTC set internal tamper

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper(RTC_HandleTypeDef *hrtc,
                                              RTC_InternalTamperTypeDef *sIntTamper)
hal_status_t HAL_TAMP_INTERNAL_SetConfigTampers(uint32_t internal_tampers,
                                                const hal_tamp_internal_individual_config_t *p_config)
hal_status_t HAL_TAMP_INTERNAL_Start(uint32_t internal_tampers, uint32_t interruption)

HAL RTC set internal tamper IT

In HAL2, there is no dedicated function for enabling internal tamper interrupts.

Instead, you need to follow the same sequence and enable the interrupt by passing it as an argument to the HAL_TAMP_INTERNAL_Start() function using HAL_TAMP_INTERNAL_IT_TAMPER_1.

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetInternalTamper_IT(RTC_HandleTypeDef *hrtc,
                                                 RTC_InternalTamperTypeDef *sIntTamper)
hal_status_t HAL_TAMP_INTERNAL_SetConfigTampers(uint32_t internal_tampers,
                                                const hal_tamp_internal_individual_config_t *p_config)
hal_status_t HAL_TAMP_INTERNAL_Start(uint32_t internal_tampers, uint32_t interruption)

HAL RTC deactivate internal tamper

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTamper(RTC_HandleTypeDef *hrtc,
                                                     uint32_t IntTamper)
hal_status_t HAL_TAMP_INTERNAL_Stop(uint32_t internal_tampers)

HAL RTC poll for internal tamper event

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_PollForInternalTamperEvent(RTC_HandleTypeDef *hrtc,
                                                       uint32_t IntTamper,
                                                       uint32_t Timeout)
hal_status_t HAL_TAMP_INTERNAL_PollForEvent(uint32_t internal_tampers,
                                            uint32_t timeout_ms)

HAL RTC set boot hardware key

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetBoothardwareKey(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_TAMP_EnableHardwareBootkeyBlock(void)

HAL RTC get active tampers

HAL1

HAL2

void HAL_RTCEx_GetActiveTampers(RTC_ActiveTampersTypeDef *sAllTamper)
void HAL_TAMP_ACTIVE_GetConfigTamper(uint32_t tamper_input,
                                     hal_tamp_active_individual_config_t *p_config)

HAL RTC get internal tampers

HAL1

HAL2

void HAL_RTCEx_GetInternalTampers(RTC_InternalTamperTypeDef *sIntTamper)
void HAL_TAMP_INTERNAL_GetConfigTamper(uint32_t internal_tamper,
                                       hal_tamp_internal_individual_config_t *p_config)

HAL RTC tamper IRQ handler

HAL1

HAL2

void HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc)
void HAL_TAMP_TamperIRQHandler(void)

HAL RTC tamper event callback

HAL1

HAL2

void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
...
void HAL_RTCEx_TamperxEventCallback(RTC_HandleTypeDef *hrtc)
void HAL_TAMP_TamperEventCallback(uint32_t tampers)

HAL RTC internal tamper event callback

HAL1

HAL2

void HAL_RTCEx_InternalTamper1EventCallback(RTC_HandleTypeDef *hrtc)
void HAL_RTCEx_InternalTamper2EventCallback(RTC_HandleTypeDef *hrtc)
...
void HAL_RTCEx_InternalTamperxEventCallback(RTC_HandleTypeDef *hrtc)
void HAL_TAMP_InternalTamperEventCallback(uint32_t internal_tampers)